Skip to content

Conversation

@alexsch01
Copy link
Contributor

@alexsch01 alexsch01 commented May 15, 2025

Backport of #8278 for npm 10 series

Includes #8297

Co-authored-by: @mbtools [email protected]


From #8288 (comment)

Since npm 10 is in a maintenance mode we're gonna sit on this PR till the next npm 11 release is out and folks have had a chance to test this new script out. If there are any hiccups that'll cut back on the backporting we have to do.

alexsch01 added 2 commits May 15, 2025 14:45
Continuation of #8267 @mbtools 

---

This fixes the command `npm test -- hello -p1 world -p2 "hello world"
--q1=hello world --q2="hello world"` in Windows PowerShell and pwsh7
- where the "test" script prints all the arguments passed after the
first "--" in the command above

Before this change

```
PS> npm test -- hello -p1 world -p2 "hello world" --q1=hello world --q2="hello world"
npm warn "world" is being parsed as a normal command line argument.
npm warn "hello world" is being parsed as a normal command line argument.
npm warn Unknown cli config "--p1". This will stop working in the next major version of npm.
npm warn Unknown cli config "--p2". This will stop working in the next major version of npm.
npm warn Unknown cli config "--q1". This will stop working in the next major version of npm.
npm warn Unknown cli config "--q2". This will stop working in the next major version of npm.

> [email protected] test
> node args.js hello world hello world world

hello
world
hello world
world
```

With this change

```
PS> npm test -- hello -p1 world -p2 "hello world" --q1=hello world --q2="hello world"

> [email protected] test
> node args.js hello -p1 world -p2 hello world --q1=hello world --q2=hello world

hello
-p1
world
-p2
hello world
--q1=hello
world
--q2=hello world
```

---

Also, fixes comma-separated values in Windows PowerShell and pwsh7

Before this change

```
PS> npm help a=1,b=2,c=3
No matches in help for: a=1 b=2 c=3
```

With this change

```
PS> npm help a=1,b=2,c=3
No matches in help for: a=1,b=2,c=3
```
@alexsch01 alexsch01 requested a review from a team as a code owner May 15, 2025 18:54
@alexsch01 alexsch01 marked this pull request as draft May 15, 2025 21:30
@alexsch01
Copy link
Contributor Author

Will need #8300 once that goes in

@alexsch01 alexsch01 closed this May 16, 2025
@alexsch01 alexsch01 changed the title fix(powershell): use Invoke-Expression to pass args invalid May 16, 2025
@alexsch01 alexsch01 deleted the v10 branch May 16, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant